package com.observer;

public class GrabStocks {
	public GrabStocks(){
		StockGrabber stockGrabber = new StockGrabber();
		
		StockObserver observer1 = new StockObserver(stockGrabber);
		
		stockGrabber.setApplePrice(123);
		stockGrabber.setIBMPrice(143);
		stockGrabber.setMakPrice(554);
		
		StockObserver observer2 = new StockObserver(stockGrabber);
		
		stockGrabber.setApplePrice(123);
		stockGrabber.setIBMPrice(143);
		stockGrabber.setMakPrice(554);
		
		stockGrabber.unregister(observer2);
		
		stockGrabber.setApplePrice(123);
		stockGrabber.setIBMPrice(143);
		stockGrabber.setMakPrice(554);
		
		
		Runnable getIBM = new GetTheStock(stockGrabber, 2, "IBM", 197.00);
		Runnable getAPPL = new GetTheStock(stockGrabber, 2, "APL", 200.00);
		Runnable getMAK = new GetTheStock(stockGrabber, 2, "MAK", 300.00);
		
		new Thread(getIBM).start();
		new Thread(getAPPL).start();
		new Thread(getMAK).start();
	}
}
